/* Upload 组件样式 */
.rg-upload {
  .ant-upload-list .ant-upload-list-item {
    padding: 0 8px !important;
    border-radius: 0 !important;
  }

  // /** 上传错误后svg图标的样式 **/
  // .ant-upload-list .ant-upload-list-item .ant-upload-icon .anticon,
  // .ant-upload-list-item-error .ant-upload-icon .anticon-paper-clip {
  //   color: var(--text-5) !important;
  //   font-size: 12px !important;
  // }

  // /** 鼠标移入上传列表项样式 **/
  // .ant-upload-list-item:hover {
  //   background-color: var(--white) !important;
  // }

  // /** 鼠标移入上传列表项删除按钮样式 **/
  .ant-btn.ant-btn-text:hover {
    background-color: var(--white) !important;
  }

  .ant-upload-wrapper .rg-upload .rg-upload--undefined .rg-upload--drag {
    width: 334px !important;
  }

  // /** 上传列表项名称样式 **/
  // .ant-upload-list-item-name {
  //   @apply text-cn-12 !important;
  // }

  /* 基础样式 */
  &.ant-upload-wrapper {
    .ant-upload {
      transition: all 0.3s ease;
    }
  }

  /* 尺寸变体 */
  &--small {
    .ant-btn {
      height: 24px;
      padding: 0 7px;
      font-size: 12px;
    }

    .ant-upload-drag {
      padding: 16px;

      .ant-upload-drag-icon {
        margin-bottom: 8px;
        font-size: 32px;
      }

      .ant-upload-text {
        margin-bottom: 4px;
        font-size: 14px;
      }

      .ant-upload-hint {
        font-size: 12px;
      }
    }
  }

  &--default {
    .ant-btn {
      height: 32px;
      padding: 4px 15px;
      font-size: 14px;
    }

    .ant-upload-drag {
      padding: 20px;

      .ant-upload-drag-icon {
        margin-bottom: 16px;
        font-size: 48px;
      }

      .ant-upload-text {
        margin-bottom: 8px;
        font-size: 16px;
      }

      .ant-upload-hint {
        font-size: 14px;
      }
    }
  }

  &--large {
    .ant-btn {
      height: 40px;
      padding: 6px 15px;
      font-size: 16px;
    }

    .ant-upload-drag {
      padding: 24px;

      .ant-upload-drag-icon {
        margin-bottom: 20px;
        font-size: 64px;
      }

      .ant-upload-text {
        margin-bottom: 12px;
        font-size: 18px;
      }

      .ant-upload-hint {
        font-size: 16px;
      }
    }
  }

  /* 变体样式 */
  &--button {
    .ant-upload {
      &:hover {
        .ant-btn {
          color: var(--ant-color-primary-hover);
          border-color: var(--ant-color-primary-hover);
        }
      }
    }
  }

  &--drag {
    .ant-upload-drag {
      background: #fafafa;
      border: 2px dashed #d9d9d9;
      border-radius: 8px;
      transition: all 0.3s ease;

      &:hover {
        background: var(--ant-color-primary-bg);
        border-color: var(--ant-color-primary);
      }

      &.ant-upload-drag-hover {
        background: var(--ant-color-primary-bg);
        border-color: var(--ant-color-primary);
      }

      .ant-upload-drag-icon {
        color: #bfbfbf;

        .anticon {
          font-size: inherit;
        }
      }

      .ant-upload-text {
        margin: 0;
        color: rgb(0 0 0 / 88%);
        font-weight: 600;
      }

      .ant-upload-hint {
        margin: 0;
        color: rgb(0 0 0 / 45%);
      }
    }
  }

  &--avatar {
    .ant-upload {
      &.ant-upload-select {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 104px;
        height: 104px;
        border: 1px dashed #d9d9d9;
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.3s ease;

        &:hover {
          border-color: var(--ant-color-primary);

          .anticon {
            color: var(--ant-color-primary);
          }
        }

        .anticon {
          color: #bfbfbf;
          font-size: 32px;
          transition: color 0.3s ease;
        }

        div {
          margin-top: 8px;
          color: rgb(0 0 0 / 65%);
          font-size: 14px;
        }
      }
    }
  }

  &--picture {
    .ant-upload-list {
      &.ant-upload-list-picture-card {
        .ant-upload-list-item {
          overflow: hidden;
          border-radius: 8px;
        }
      }
    }

    .ant-upload {
      &.ant-upload-select {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 104px;
        height: 104px;
        border: 1px dashed #d9d9d9;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;

        &:hover {
          border-color: var(--ant-color-primary);

          .anticon {
            color: var(--ant-color-primary);
          }
        }

        .anticon {
          color: #bfbfbf;
          font-size: 32px;
          transition: color 0.3s ease;
        }

        div {
          margin-top: 8px;
          color: rgb(0 0 0 / 65%);
          font-size: 14px;
        }
      }
    }
  }

  /* 禁用状态 */
  &.ant-upload-disabled {
    .ant-upload {
      cursor: not-allowed;

      &:hover {
        border-color: #d9d9d9 !important;

        .ant-btn {
          color: rgb(0 0 0 / 25%) !important;
          border-color: #d9d9d9 !important;
        }

        .anticon {
          color: #bfbfbf !important;
        }
      }
    }

    .ant-upload-drag {
      background: #f5f5f5;
      border-color: #d9d9d9;

      &:hover {
        background: #f5f5f5 !important;
        border-color: #d9d9d9 !important;
      }

      .ant-upload-drag-icon,
      .ant-upload-text,
      .ant-upload-hint {
        color: rgb(0 0 0 / 25%);
      }
    }
  }

  /* 上传列表样式优化 */
  .ant-upload-list {
    .ant-upload-list-item {
      transition: all 0.3s ease;

      &:hover {
        background-color: #f5f5f5;
      }

      .ant-upload-list-item-info {
        .ant-upload-list-item-name {
          color: rgb(0 0 0 / 88%);
        }
      }

      .ant-upload-list-item-actions {
        .anticon {
          color: rgb(0 0 0 / 45%);
          transition: color 0.3s ease;

          &:hover {
            color: var(--ant-color-primary);
          }
        }
      }
    }
  }

  /* 自定义上传列表容器 */
  .rg-upload-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* 自定义上传列表 */
  .rg-upload-custom-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
  }

  .rg-upload-custom-list-item {
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 12px;
    background: #fafafa;
    transition: all 0.3s ease;

    &:hover {
      border-color: var(--ant-color-primary);
      background: #f0f8ff;
    }
  }

  /* Upload list optimizations */
  .rg-upload-list {
    margin-top: 8px;

    .rg-upload-item {
      display: flex;
      align-items: center;
      padding: 8px 12px;
      border: 1px solid #d9d9d9;
      border-radius: 6px;
      margin-bottom: 8px;
      background: #fafafa;

      &:last-child {
        margin-bottom: 0;
      }

      .rg-upload-item-info {
        flex: 1;
        min-width: 0;

        .rg-upload-item-name {
          font-size: 14px;
          color: #262626;
          margin-bottom: 4px;
          word-break: break-all;
        }

        .rg-upload-item-size {
          font-size: 12px;
          color: #8c8c8c;
        }
      }

      .rg-upload-item-status {
        margin: 0 12px;
        min-width: 120px;

        .rg-upload-item-progress {
          width: 100%;

          .progress-bar {
            height: 6px;
            background-color: #f0f0f0;
            border-radius: 3px;
            overflow: hidden;

            .progress-fill {
              height: 100%;
              background-color: #1890ff;
              transition: width 0.3s ease;
              border-radius: 3px;
            }
          }
        }

        .rg-upload-item-success {
          font-size: 12px;
          color: #52c41a;
        }

        .rg-upload-item-error {
          font-size: 12px;
          color: #ff4d4f;
        }
      }

      .rg-upload-item-actions {
        display: flex;
        gap: 8px;

        .anticon {
          cursor: pointer;
          color: #8c8c8c;
          transition: color 0.3s;

          &:hover {
            color: #1890ff;
          }
        }
      }
    }
  }

  /* 默认自定义列表项样式 */
  .rg-upload-default-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    .rg-upload-item-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 4px;
      min-width: 0;

      .rg-upload-item-name {
        font-size: 14px;
        font-weight: 500;
        color: rgb(0 0 0 / 88%);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .rg-upload-item-size {
        font-size: 12px;
        color: rgb(0 0 0 / 45%);
      }
    }

    .rg-upload-item-status {
      display: flex;
      align-items: center;
      font-size: 12px;

      .rg-upload-item-progress {
        color: var(--ant-color-primary);
      }

      .rg-upload-item-success {
        color: #52c41a;
      }

      .rg-upload-item-error {
        color: #ff4d4f;
      }
    }

    .rg-upload-item-actions {
      display: flex;
      align-items: center;
      gap: 4px;

      .ant-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        padding: 0;
        border: none;
        background: transparent;

        &:hover {
          background: rgb(0 0 0 / 6%);
        }

        &.ant-btn-dangerous:hover {
          background: #fff2f0;
          color: #ff4d4f;
        }

        .anticon {
          font-size: 14px;
        }
      }
    }
  }
}

/* 响应式设计 */
@media (width <= 768px) {
  .rg-upload {
    &--drag {
      .ant-upload-drag {
        padding: 16px;

        .ant-upload-drag-icon {
          margin-bottom: 12px;
          font-size: 40px;
        }

        .ant-upload-text {
          margin-bottom: 6px;
          font-size: 14px;
        }

        .ant-upload-hint {
          font-size: 12px;
        }
      }
    }

    &--avatar,
    &--picture {
      .ant-upload-select {
        width: 80px;
        height: 80px;

        .anticon {
          font-size: 24px;
        }

        div {
          margin-top: 4px;
          font-size: 12px;
        }
      }
    }
  }
}

/* 暗色主题适配 */
[data-theme='dark'] {
  .rg-upload {
    &--drag {
      .ant-upload-drag {
        background: rgb(255 255 255 / 4%);
        border-color: #434343;

        &:hover,
        &.ant-upload-drag-hover {
          background: rgb(24 144 255 / 10%);
          border-color: #1890ff;
        }

        .ant-upload-text {
          color: rgb(255 255 255 / 85%);
        }

        .ant-upload-hint {
          color: rgb(255 255 255 / 45%);
        }
      }
    }

    &--avatar,
    &--picture {
      .ant-upload-select {
        border-color: #434343;

        &:hover {
          border-color: #1890ff;
        }

        div {
          color: rgb(255 255 255 / 65%);
        }
      }
    }
  }
}
